package it.unibo.imola.parser.visitor.entity;

public class IMPNoiseStatement extends BuiltinCallStatement {

	public IMPNoiseStatement(ToolBox toolbox) {
		super("IMP_NOISE", toolbox);
	}
	
	@Override
	public boolean check(GlobalEnvironment gEnv, Environment env) throws Exception {
		if(!super.check(gEnv, env))
			return false;
		if(actualParametersList.get(2) instanceof Float){
			if((Float)actualParametersList.get(2) > 1.0){
				throw new Exception("");
			}
		}
		if(actualParametersList.get(3) instanceof Integer){
			int noiseType = (Integer)actualParametersList.get(3);
			if(0 > noiseType || noiseType > 3){
				throw new Exception("accepted noise types are: PEPPER (0), SALT (1), and SALT-AND-PEPPER (2)");
			}
		}
		return true;
	}

}
